package juego.modelo;

public class BonusActivo implements Runnable {


	private Bonus bonus;
	private int nivel;
	private int duracionInicial;
	private int duracion;

	public BonusActivo(Bonus bonus, int nivel) {
		this.bonus = bonus;
		this.nivel = nivel;
		this.duracionInicial = 20000;
		this.duracion=2000;

	}

	public void run() {
		if (this.nivel>9) this.nivel=9;
		bonus.setActivo(false);
		try {
			Thread.sleep(duracionInicial);
			bonus.setActivo(true);
			Thread.sleep(duracionInicial - nivel * duracion);
			bonus.setActivo(false);
			Thread.sleep(duracionInicial);
			bonus.setActivo(true);
			Thread.sleep(duracionInicial - nivel * duracion);
			bonus.setActivo(false);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}


